﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ConfigInstance.cs" company="SmartPlan">
//   SmartPlan 2011
// </copyright>
// <summary>
//   The config instance class
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace DbDiff.Common.Helper
{
    /// <summary>
    /// The config instance class
    /// </summary>
    public class ConfigInstance
    {
        private  static readonly object locking = new object();

        /// <summary>
        /// The static config file
        /// </summary>
        private static Config config;

        /// <summary>
        /// Gets Config.
        /// </summary>
        public static Config Config
        {
            get
            {
                lock (locking)
                {
                    return config;
                }
            }
        }

        static ConfigInstance()
        {
            lock (locking)
            {
                config = new Config();
            }
        }

        public static void SetConfig(Config newConfig)
        {
            lock (locking)
            {
                config = newConfig;                
            }
        }
    
    }
}